package com.xm.xmapp;

import android.os.Bundle;
import android.widget.TextView;

import com.xm.xmapp.adapter.TimePriceAdapter;
import com.xm.xmapp.base.BaseActivity;
import com.xm.xmapp.customview.XListView;
import com.xm.xmapp.response.bean.ResponsePileDetail;
import com.xm.xmapp.response.bean.ResponsePileDetail.Price;

public class TimePriceActivity extends BaseActivity  {
	private XListView xListView;
	private TimePriceAdapter adapter;
	private ResponsePileDetail bean;
	private TextView time,charge_electric,charge_service;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_timeprice);
	}

	@Override
	public void initView() {
		xListView = (XListView) findViewById(R.id.xListView);
		time = (TextView) findViewById(R.id.time);
		charge_electric = (TextView) findViewById(R.id.charge_electric);
		charge_service = (TextView) findViewById(R.id.charge_service);
	}

	@Override
	public void initData() {
		setMyTitle("价格表");	
		bean = (ResponsePileDetail) getIntent().getSerializableExtra("bean");
		Price first_price;	
		if(bean.first_price!=null)
		{
			first_price = bean.first_price;
		}else
		{
			first_price = bean.price.get(0);
		}
    	time.setText(first_price.duration_start+"-"+first_price.duration_end);
		charge_electric.setText("电费："+first_price.charge_electric+"元/度");
		charge_service.setText("服务费："+first_price.charge_service+"元/度");
    	adapter = new TimePriceAdapter(bean.price, this,
				R.layout.item_timeprice);

		xListView.setAdapter(adapter);
		xListView.setPullRefreshEnable(false);
		xListView.setPullLoadEnable(false);
	}

	@Override
	public void initEvent() {
	}
	
}
